From fd840361b1e8ec453f51bac317efc2df5c050119 Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Wed, 26 Mar 2008 23:19:45 +0000 Subject: [PATCH] API: (bug 11719) Remove trailing blanks in YAML output. --- RELEASE-NOTES | 1 + includes/api/ApiFormatYaml_spyc.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a665820f58..67553f0eb4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -168,6 +168,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added help text message that specifies whether a module is POST-only * Added createonly parameter to action=edit * Replaced $wgAPIUCUserPrefixMinLength by the more generic $wgAPIMaxDBRows +* (bug 11719) Remove trailing blanks in YAML output. === Languages updated in 1.13 === diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php index a6cd26dc9b..72c89e4a87 100644 --- a/includes/api/ApiFormatYaml_spyc.php +++ b/includes/api/ApiFormatYaml_spyc.php @@ -424,10 +424,16 @@ if (is_int($key)) { // It's a sequence - $string = $spaces.'- '.$value."\n"; + if ($value) + $string = $spaces.'- '.$value."\n"; + else + $string = $spaces . "-\n"; } else { - // It's mapped - $string = $spaces.$key.': '.$value."\n"; + // It's mapped + if ($value) + $string = $spaces.$key.': '.$value."\n"; + else + $string = $spaces . $key . ":\n"; } return $string; } -- 2.20.1